﻿using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;

namespace ZFB.Models.EntityConfig
{
    public class HousesConfig : IEntityTypeConfiguration<T_Houses>
    {
        public void Configure(EntityTypeBuilder<T_Houses> builder) 
        {
            builder.ToTable("T_Houses");
            builder.Property(e => e.OwnerPhoneNum).IsUnicode(false);
            builder.HasMany(e=>e.T_HouseAppointments).WithOne(e=>e.T_Houses).HasForeignKey(e => e.HouseId).OnDelete(DeleteBehavior.Restrict);
            builder.HasMany(e=>e.T_HousePics).WithOne(e => e.T_Houses).HasForeignKey(e => e.HouseId).OnDelete(DeleteBehavior.Restrict);



        }
    }
}
